/**
 * 
 */
package com.thinkgsp.jxc.model;

import java.io.Serializable;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

/**
 * 职员类
 * @author evan
 *
 */
public class Emp extends BaseModel implements Serializable {

	private static final long serialVersionUID = -3470084409336242824L;

	private Integer empId;
	private String empCode;
	private String empName;
	private Integer deptId;
	private Dept dept;
	
	
	public Dept getDept() {
		return dept;
	}

	public void setDept(Dept dept) {
		this.dept = dept;
		if(dept != null) {
			this.deptId = dept.getDeptId();
		}
	}

	/**
	 * 职员ID
	 * @return
	 */
	public Integer getEmpId() {
		return empId;
	}

	public void setEmpId(Integer empId) {
		this.empId = empId;
	}

	/**
	 * 职员工号
	 * @return
	 */
	public String getEmpCode() {
		return empCode;
	}

	public void setEmpCode(String empCode) {
		this.empCode = empCode;
	}

	/**
	 * 职员姓名
	 * @return
	 */
	public String getEmpName() {
		return empName;
	}

	public void setEmpName(String empName) {
		this.empName = empName;
	}

	/**
	 * 所在部门
	 * @return
	 */
	public Integer getDeptId() {
		return deptId;
	}

	public void setDeptId(Integer deptId) {
		this.deptId = deptId;
	}

	/* (non-Javadoc)
	 * @see com.thinkgsp.jxc.model.BaseModel#toString()
	 */
	@Override
	public String toString() {
		ToStringBuilder sb = new ToStringBuilder(this, ToStringStyle.DEFAULT_STYLE);
		sb.append("empId",this.empId)
		  .append("empCode",this.empCode)
		  .append("empName",this.empName);
		
		return sb.toString();
	}

	/* (non-Javadoc)
	 * @see com.thinkgsp.jxc.model.BaseModel#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object o) {
		if(this == o) {
			return true;
		}
		if(!(o instanceof Emp)) {
			return false;
		}
		final Emp emp = (Emp)o;
		if(empId != null) {
			return empId.equals(emp.getEmpId());
		} else {
			return emp.getEmpId() == null;
		}
	}

	/* (non-Javadoc)
	 * @see com.thinkgsp.jxc.model.BaseModel#hashCode()
	 */
	@Override
	public int hashCode() {
		return (this.empId != null ? this.empId.hashCode() : 0);
	}

}
